import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  build: {
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      name: 'AuTableEditor',
      fileName: (format) => `au-table-editor.${format}.js`,
    },
    rollupOptions: {
      // make sure to externalize deps that shouldn't be bundled
      // into your library
      external: ['vue', '@aurouscia/au-undo-redo', '@aurouscia/keyboard-shortcut'],
      output: {
        // Provide global variables to use in the UMD build
        // for externalized deps
        globals: {
          vue: 'Vue',
          '@aurouscia/au-undo-redo': 'AuUndoRedo',
          '@aurouscia/keyboard-shortcut': 'KeyboardShortcut'
        },
      },
    },
    emptyOutDir:true
  },
  css:{
    preprocessorOptions:{
      scss: {
        api: 'modern-compiler',
      },
    }
  }
})
